from pathlib import Path
from ssb import NR
class opnr:
    def __init__(self):
        pass
    
    def fName(self, name):
        self.f_name = name
        return self
    
    def set_search_end(self,up):
        self.f_end = up
        return self
    
    def set_search_start(self,down):
        self.f_start = down
        return self
    
    def NR(self):
        return NR(self.f_name).set_search_end(self.f_end).set_search_start(self.f_start)
    
    def __str__(self) -> str:
        return f"{self.f_name} from {self.f_start} to {self.f_end}"    
    
def CMCC2_5G():
    p = Path('.')
    for f in p.glob('*.sigmf-data'):
        if '2565.0m' in str(f):
            return opnr().fName(f.name).set_search_start(2515e6).set_search_end(2530e6)
    return None

def CUCC3_4G():
    p = Path('.')
    for f in p.glob('*.sigmf-data'):
        if '3450.0m' in str(f):
            return opnr().fName(f.name).set_search_start(3405e6).set_search_end(3410e6)
    return None

def CTCC3_5G():
    p = Path('.')
    for f in p.glob('*.sigmf-data'):
        if '3550.0m' in str(f):
            return opnr().fName(f.name).set_search_start(3505e6).set_search_end(3510e6)
    return None
def CMCC0_7G():
    p = Path('.')
    for f in p.glob('*.sigmf-data'):
        if '800.0m' in str(f):
            return opnr().fName(f.name).set_search_start(758e6).set_search_end(800e6)
    return None